{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item" id="fordaochu">

                        <div class="layui-col-md6 layui-input-inline" style="width:300px;">
                            <input type="text" id="school" class="layui-input search" name="school" value="" placeholder="学校名字/学校名字/订单号/学生姓名/联系手机"/>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" class="layui-input search" name="year" value="" placeholder="年份"/>
                        </div>
                        <div class="layui-input-inline layui-form">
                            <select name="o_status" id="o_status" lay-search="" class="layui-input">
                                <option  value="">全部订单</option>
                                <option  value="1">未发货</option>
                                <option  value="2">已发货</option>
                            </select>
                        </div>
                        <div class="layui-input-inline" style="width: 300px;">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--搜索框结束-->
                <!--操作框开始-->
                <div class="col-sm-12">
                    <div class="input-group">
                        <button class="btn btn-primary" type="button" onclick="wk.href('{:url('excelIn')}');">
                            <i class="fa fa-file-excel-o"></i> 物流信息导入
                        </button>
                        <button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">
                            <i class="fa fa-wrench"></i> 批量操作 <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">
                            <li><a  href="javascript:;" class="layuiBtn" data-type="excelAll"><i class="fa fa-external-link"></i> 导出数据</a></li>
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAllNoSelect"><i class="fa fa-external-link"></i> 全部导出</a></li>-->
                        </ul>
                    </div>
                </div>
                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <script type="text/html" id="status">
                        {{# if(d.send_status == 1){ }}
                        <span style="color: red;font-weight: bold;">未发货</span>
                        {{# } }}
                        {{# if(d.send_status == 2){ }}
                        <span style="color: mediumseagreen;font-weight: bold;">已发货</span>
                        {{# } }}
                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        {{# if(d.send_status == 2){ }}
                        <a href="javascript:;" onclick="wk.layer_show('查看物流', '{:url('see_wuliu')}?o_id={{d.o_id}}')" class="btn btn-primary btn-xs m-r-xs" title="查看物流">查看物流</a>
                        {{# } }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.o_id}}','{:url('orderdel')}')" class="btn btn-danger btn-xs m-r-xs" title="删除"><i class="fa fa-trash-o">删除</i></a>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Wechat/order")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
//                {type: 'checkbox', fixed: 'left',}
                  {type:'numbers', width: 70, title: '序号'}
                , {field: 'orderno', width: '', title: '订单号', align: 'center'}
                , {field: 'school', width: '', title: '学校名称', align: 'center'}
                , {field: 'year', width: '', title: '年份', align: 'center'}
                , {field: 'grade', width: '', title: '年级', align: 'center'}
                , {field: 'name', width: '', title: '学生姓名', align: 'center'}
                , {field: 'sex', width: '', title: '学生性别', align: 'center'}
                , {field: 'size', width: '', title: '尺码', align: 'center'}
                , {field: 'height', width: '', title: '身高', align: 'center'}
                , {field: 'weight', width: '', title: '体重', align: 'center'}
                , {field: 'phone', width: '', title: '联系电话', align: 'center'}
                , {field: 'send_name', width: '', title: '收件人', align: 'center'}
                , {field: 'send_address', width: '', title: '收件地址', align: 'center'}
                , {field: 'add_time', width: '', title: '提交时间', align: 'center'}
                , {field: 'status', width: '', title: '发货状态', align: 'center', templet: '#status'}
                , {fixed: 'right', width: 160, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('.img-circle').viewer({
                    url: 'data-original',
                });
            }
        });
        //批量操作
        var $ = layui.$, active = {
            excelAll: function(){
                //导出Excel
                wk.excelAll('',$('.layui-input').serialize(),"{:url('excelOut')}");
            }
        };
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                , data = checkStatus.data;
            $.each(data, function (index, item) {
                ids.push(item['good_id'])
            });
            return ids;
        }
    });

</script>
</body>
</html>